import { setCookie, getCookie, removeCookie } from './cookie';

const userInfo = {
  loginSuccess: (uid: string, uname: string, uup: string) => {
    setCookie('uid', uid);
    setCookie('uname', uname);
    setCookie('uup', uup);
  },
  getUserInfo: () => {
    return {
        uid: getCookie('uid'),
        uname: getCookie('uname'),
        uup: getCookie('uup'),
    }
  },
  logout: () => {
    removeCookie('uid');
    removeCookie('uname');
    removeCookie('uup');
    window.location.href = '/login';
  }
}

export default userInfo;